package com.exrobot.module.rbt.dal.mysql.canteenmenu;

import java.util.*;

import com.exrobot.framework.common.pojo.PageResult;
import com.exrobot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.exrobot.framework.mybatis.core.mapper.BaseMapperX;
import com.exrobot.module.rbt.dal.dataobject.canteenmenu.CanteenMenuDO;
import org.apache.ibatis.annotations.Mapper;
import com.exrobot.module.rbt.controller.admin.canteenmenu.vo.*;

/**
 * 食堂菜单 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CanteenMenuMapper extends BaseMapperX<CanteenMenuDO> {

    default PageResult<CanteenMenuDO> selectPage(CanteenMenuPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CanteenMenuDO>()
                .eqIfPresent(CanteenMenuDO::getCanteenSn, reqVO.getCanteenSn())
                .eqIfPresent(CanteenMenuDO::getMenuSn, reqVO.getMenuSn())
                .inIfPresent(CanteenMenuDO::getMenuSn, reqVO.getMenuSns())
                .likeIfPresent(CanteenMenuDO::getName, reqVO.getName())
                .eqIfPresent(CanteenMenuDO::getPrice, reqVO.getPrice())
                .eqIfPresent(CanteenMenuDO::getImg, reqVO.getImg())
                .eqIfPresent(CanteenMenuDO::getInfo, reqVO.getInfo())
                .eqIfPresent(CanteenMenuDO::getSort, reqVO.getSort())
                .betweenIfPresent(CanteenMenuDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CanteenMenuDO::getId));
    }

}